<?php

class CCoreSocketSmtpMessage
{
	#<editor-fold defaultstate="collapsed" desc="private">
	/**
	 * @var	string
	 */
	private $_sFrom;

	/**
	 * @var	array
	 */
	private $_aTo;

	/**
	 * @var	string
	 */
	private $_sBody;
	#</editor-fold>

	/**
	 * @param	string	$sFrom
	 * @param	string	$sBody
	 * @param	array	$aTo = array()
	 * @return	CCoreSocketSmtpMessage
	 */
	public function __construct($sFrom, $sBody, $aTo = array())
	{
		CCore::CheckTypes(array('$sFrom', '$sBody', '$aTo'));
		
		$this->_sFrom = $sFrom;
		$this->_sBody = $sBody;
		$this->_aTo = (array) $aTo;
	}

	/**
	 * @param	string	$sTo
	 * @return	void
	 */
	public function AddTo($sTo)
	{
		CCore::CheckTypes(array('$sTo'));
		
		$this->_aTo[] = trim($sTo);
	}

	/**
	 * @return	string
	 */
	public function ToAsArray()
	{
		return $this->_aTo;
	}

	/**
	 * @return	string
	 */
	public function FromAsString()
	{
		return $this->_sFrom;
	}

	/**
	 * @return	string
	 */
	public function BodyAsString()
	{
		return $this->_sBody;
	}
}